UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yeyMAfxSO1bMhln+Ld/a5KQkGKEIf58YpMYghQjQMPg=' 
WHERE 
  key_id = '2f0ddf40f2759357570b9029ef5e2799405e8abd01b1b14da61720b356c29a6b' 
  AND (
    token = 'yeyMAfxSO1bMhln+Ld/a5KQkGKEIf58YpMYghQjQMPg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047