UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cL68kQpoWWBHKfOje2b9qthRd1d0l6tw443Cr+qvdog=' 
WHERE 
  key_id = 'f3d4eab3b3532e3c080380f9afc0c919e5bf63318c1ef963d984d432d79714b7' 
  AND (
    token = 'cL68kQpoWWBHKfOje2b9qthRd1d0l6tw443Cr+qvdog=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050