UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aOs1dwAFFWiR2BxfmHquxkWcEdxOiwMWx4sRz1PVXjg=' 
WHERE 
  key_id = '0396c2f489806fb0a6d8bdcdc5cc86ad9473f68358602d3e79190549cec9c7ff' 
  AND (
    token = 'aOs1dwAFFWiR2BxfmHquxkWcEdxOiwMWx4sRz1PVXjg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040