UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kvs9tfrm4+lOqyqO91JuzG4ire8pWqxxxUXL6S598XE=' 
WHERE 
  key_id = '81748e84964226d5a3e87875088fc11e01f60bed6b47c6be3860a0702510d329' 
  AND (
    token = 'kvs9tfrm4+lOqyqO91JuzG4ire8pWqxxxUXL6S598XE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044