UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'heo4k2UbxiO1tu1cWt7dOu6UDdH9AM5r0qaKBFB+tM8=' 
WHERE 
  key_id = 'd56bae8db29dbbf9f5da0297d3fd5cf49c9b42e778684e3b4cc8a36599f3e66a' 
  AND (
    token = 'heo4k2UbxiO1tu1cWt7dOu6UDdH9AM5r0qaKBFB+tM8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024