UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KuTZS4KFjhTp5rBOcQuvO6xLQVVcbQrIVxtdXkA5wxo=' 
WHERE 
  key_id = '230af219bde55e9fde985db29d628b68adf902e65c3996b725a7fb7b00e23c56' 
  AND (
    token = 'KuTZS4KFjhTp5rBOcQuvO6xLQVVcbQrIVxtdXkA5wxo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049