UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4bwHGen1ww+IdcismvB3HQPQKfbKxJqZhEcJdbrM7ps=' 
WHERE 
  key_id = 'f512a4155baeb62245f081936ad96e730864a77939bfdbafe6742939f4fd718c' 
  AND (
    token = '4bwHGen1ww+IdcismvB3HQPQKfbKxJqZhEcJdbrM7ps=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034