UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kgiLR2iMlANzosOMyL/y6pgi1ISQcUOgmEJx+ZRZKM4=' 
WHERE 
  key_id = '674937bb77dcc899320600a08639a081c6288167df4577b25b8800f8470f2bfd' 
  AND (
    token = 'kgiLR2iMlANzosOMyL/y6pgi1ISQcUOgmEJx+ZRZKM4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035