UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8MJcw3jkzm/28oZf5+G2aEXB6tl67DFe/+6cfsNz5Ws=' 
WHERE 
  key_id = '6f652d0156cfceb42fb7de7326f78916b7da28c3c014d67d764d6943f476a4fd' 
  AND (
    token = '8MJcw3jkzm/28oZf5+G2aEXB6tl67DFe/+6cfsNz5Ws=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046