UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6ozkFwH7kn+woSbVlcRNkRDjSerUxeU0bYS+D61okfs=' 
WHERE 
  key_id = '5e9b8118d4514427d5e5f0f4a267deac8940fda9cca342ec826d818454899005' 
  AND (
    token = '6ozkFwH7kn+woSbVlcRNkRDjSerUxeU0bYS+D61okfs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054