UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uDSaX/6pk9pk/khFLQKpoX1dCPgUAtSJDczhzM3EHWQ=' 
WHERE 
  key_id = '17be834351c35c1f839e9865318fa39daeeb3aa6d77cb0b958cbe51df9b21bfd' 
  AND (
    token = 'uDSaX/6pk9pk/khFLQKpoX1dCPgUAtSJDczhzM3EHWQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052