UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Dtvi1TVVuSt3Sa6jFnPSxW9MDw0d3UbCxx8bMqSxmYU=' 
WHERE 
  key_id = 'b6bae1436d8ee09243b3c1ce0fcacd14e30e1d288b6b3999308bd91e9c5e4713' 
  AND (
    token = 'Dtvi1TVVuSt3Sa6jFnPSxW9MDw0d3UbCxx8bMqSxmYU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028