UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NhCkPK1tsjmMgj56KFjultEm5iYA6s3zIVq6O6yJ3rE=' 
WHERE 
  key_id = '4d7a4c9b1747fc7ef90a8bc47b1b377e386b95c090290272ce3ace04a1e906ed' 
  AND (
    token = 'NhCkPK1tsjmMgj56KFjultEm5iYA6s3zIVq6O6yJ3rE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045