UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q3xBSP9uF92AzK8gwOt4QblUBye4tYKsjs7uwGtKLdk=' 
WHERE 
  key_id = '9ced6f44222dcc724162cc2457fd4e1295d133e1112bfd22f36eedde6e8445a8' 
  AND (
    token = 'q3xBSP9uF92AzK8gwOt4QblUBye4tYKsjs7uwGtKLdk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034