UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YtrwlTpUsX9z/f/zoDDmoWdECjMAUlpoF8avczukN/k=' 
WHERE 
  key_id = '5aec7e018da680679cbbbf8513a9d2cbd01c70032bc49713b7f56851b78b82b9' 
  AND (
    token = 'YtrwlTpUsX9z/f/zoDDmoWdECjMAUlpoF8avczukN/k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023