UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3ylrrpl22nV5CKR5nZj37LCBuzM2HN3dO6sLC7QEmOM=' 
WHERE 
  key_id = '3fa6c3102292b6f95e5db5a1971e46cffd7b223c946434adca524c085d9404d1' 
  AND (
    token = '3ylrrpl22nV5CKR5nZj37LCBuzM2HN3dO6sLC7QEmOM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038