UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dm29LxoBNuGLzfjaXrF8YK8ONXr1a8qWV4ie43mOja8=' 
WHERE 
  key_id = '035aa242d705839a8290f7143d4fbde6178db1802f765578d7255ab0df2da798' 
  AND (
    token = 'dm29LxoBNuGLzfjaXrF8YK8ONXr1a8qWV4ie43mOja8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026