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

Query time 0.00034