UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '40BpYdzRA39ee7DNoHlXk+D37K9lD+4Ji9b3KExYRQU=' 
WHERE 
  key_id = 'a16234da9781ba495b57e848fcb9605093c886a19a53c014ef0b9f108b18ab5f' 
  AND (
    token = '40BpYdzRA39ee7DNoHlXk+D37K9lD+4Ji9b3KExYRQU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030