UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DVi7aHMz0IXa4XWljouLdeE7DHEP0bEQBF6iHIU0pSA=' 
WHERE 
  key_id = '0226d6d43033cc197e2c24c2512ca401bb8b47a427ca3b627304fc948612327c' 
  AND (
    token = 'DVi7aHMz0IXa4XWljouLdeE7DHEP0bEQBF6iHIU0pSA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039