UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ULnckRF3MCiX69wwQnTB2iACiKYKH7j7u6C06XFekiw=' 
WHERE 
  key_id = 'd5f617c261f7c5eb16b25fa4ffe7d156fa190d5df8ee718d2c8ee3fa3a2e8d01' 
  AND (
    token = 'ULnckRF3MCiX69wwQnTB2iACiKYKH7j7u6C06XFekiw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040