UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VbDOXnJX29F+iQEepwOjhPAxIor2zq63B6ENfPXGtP4=' 
WHERE 
  key_id = '8468ddbab801ccba35ffd0ac15b54d2524ce363991984eda802a9d19807ad040' 
  AND (
    token = 'VbDOXnJX29F+iQEepwOjhPAxIor2zq63B6ENfPXGtP4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045