UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gUSNBUIL+EGKrJEpTKUqNcK5ULhrH/MZn9x2k3+RPPo=' 
WHERE 
  key_id = '5694326260c31d4fbef62bdc0295d0f01e230780e18c1aa150036de910370281' 
  AND (
    token = 'gUSNBUIL+EGKrJEpTKUqNcK5ULhrH/MZn9x2k3+RPPo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026