UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1zNSibOg4wrL0aM0/oeEF72GGVnJPZvvHF+BMwtRtXU=' 
WHERE 
  key_id = '784007f6a3a4a49b854ca4ecc4e04263137b3577e624d1780d9886fcb6338f36' 
  AND (
    token = '1zNSibOg4wrL0aM0/oeEF72GGVnJPZvvHF+BMwtRtXU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037