UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QkOUnv4nxwFqZHPAomlL/FYZ+I5sfknMdj5xsdtSPH4=' 
WHERE 
  key_id = '824a77bae893083647f1f95ce33f435f979737a2b85f73b85a85affb07cfd7f1' 
  AND (
    token = 'QkOUnv4nxwFqZHPAomlL/FYZ+I5sfknMdj5xsdtSPH4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020