UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RMsbUBefXWBIedzA25FYVfhaIbR6r08/dgyl9uopbgs=' 
WHERE 
  key_id = '405ce30657fa7125491d7f0160cf7355f4313d65b26551f58439e5e8d376cec1' 
  AND (
    token = 'RMsbUBefXWBIedzA25FYVfhaIbR6r08/dgyl9uopbgs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034