UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Mq40rkR3h/r6a+i2S2YN+XK3ozoLsxAclGOYQh6Tcfs=' 
WHERE 
  key_id = '1d3d9556d46f30bad4bf02e4215e7dcde33f41cc761e84e8c6850af7687c1ab0' 
  AND (
    token = 'Mq40rkR3h/r6a+i2S2YN+XK3ozoLsxAclGOYQh6Tcfs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023