UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gaSQo+kgozFCGVODohNViuuuQ9VH+87R6LHdISrdTng=' 
WHERE 
  key_id = '193dc95a4bdda49f561bf56c25c03c55726791dd6d48b877596150c591e99482' 
  AND (
    token = 'gaSQo+kgozFCGVODohNViuuuQ9VH+87R6LHdISrdTng=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030