UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p6W0vDMxi0hq848OGW4KKFYkM02qUBYyym5iBX/PMD8=' 
WHERE 
  key_id = '479067837f467045ebf98fb1e714720c171e95a8a9adaf2873f2eed5140b34f3' 
  AND (
    token = 'p6W0vDMxi0hq848OGW4KKFYkM02qUBYyym5iBX/PMD8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034