UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yb5oL+kxk42pm5XS08pozO1UpqEN4XOz0Adq3mBN6/Q=' 
WHERE 
  key_id = 'ed6e42a5a3b683491d7b8953f4b7ee2128c5ab637645b1c576a6ae140f5d7ac6' 
  AND (
    token = 'yb5oL+kxk42pm5XS08pozO1UpqEN4XOz0Adq3mBN6/Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041