UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8lhmENHFmfjdy0jP8xqRitzQMxPz4+9Xm/w/hVK7gDU=' 
WHERE 
  key_id = '18b2666c83ffabd7f327b497ad9390fdbc909b1d747982b54408f133641c4572' 
  AND (
    token = '8lhmENHFmfjdy0jP8xqRitzQMxPz4+9Xm/w/hVK7gDU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024