UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PlOcX5FpVHC52xewLq/2y0H/6XHVd9oX4tartSKeZVQ=' 
WHERE 
  key_id = 'a171be4963601650a309bc114827994c9cd07f7028b999d6802278d575d5e386' 
  AND (
    token = 'PlOcX5FpVHC52xewLq/2y0H/6XHVd9oX4tartSKeZVQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019