UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bl4ZEykMRRSxpN0ekoUOYVnZPixN604Sa9c6cW/aV08=' 
WHERE 
  key_id = 'c678d0f681de6c6f505918e155955267ae068f553d2a5adb1a89b61c7034ead7' 
  AND (
    token = 'bl4ZEykMRRSxpN0ekoUOYVnZPixN604Sa9c6cW/aV08=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046