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

Query time 0.00027