UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B64ayrk/eSGPkoE3UsXG8FEcrTQd/eaBD9PZCbapBsE=' 
WHERE 
  key_id = '319d1a5942e5bcc4cc5fcba60c1246cd6125f9fe91e45ef13da38c72133f3ce1' 
  AND (
    token = 'B64ayrk/eSGPkoE3UsXG8FEcrTQd/eaBD9PZCbapBsE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00080