UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4xm+9QkzDEvrs40A4frkf4YT1fmPDW05YaDjMDMdsL8=' 
WHERE 
  key_id = '9f4b391245c24d5dad7f57c4afb524c5128db650f8fc53a2c80f4293719a15a8' 
  AND (
    token = '4xm+9QkzDEvrs40A4frkf4YT1fmPDW05YaDjMDMdsL8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032