UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aSPU2DpKPq5kO39dw4aJAZfdJis+szw84EY/oQkZXrY=' 
WHERE 
  key_id = '4fbf29d61b96daffd6a800edff615d69d6ea00585c67b580f458623d12829d95' 
  AND (
    token = 'aSPU2DpKPq5kO39dw4aJAZfdJis+szw84EY/oQkZXrY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015