UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dyo+y0kZXAB0P3VE4b95Iz7xNGnKYgdsFnUdaGVdll0=' 
WHERE 
  key_id = '08919d47e7d338921e2064a0b7c422a9cc8d6f20f65292a55cda3ccc98d0ef33' 
  AND (
    token = 'dyo+y0kZXAB0P3VE4b95Iz7xNGnKYgdsFnUdaGVdll0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033