UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GkClfLUPxZJhnSZT3+VxLzcEag/SJ26D63C1TMIYENs=' 
WHERE 
  key_id = '34bcc24ac1b837e55cbdc7366fed2eb235505376c83a7cc4ccec4542f04eed3d' 
  AND (
    token = 'GkClfLUPxZJhnSZT3+VxLzcEag/SJ26D63C1TMIYENs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026