UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y7xRqoREjg2Yj8dqwN2dEDacKzTTQUR/gZi6d4Bc3BI=' 
WHERE 
  key_id = 'd626b89392e256378737d93bf00fd9b6fd23a5ed6bd30341936b812ccc6ce27d' 
  AND (
    token = 'Y7xRqoREjg2Yj8dqwN2dEDacKzTTQUR/gZi6d4Bc3BI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00122