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

Query time 0.00030