UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BtuvzS9sJ0xsx6V9y/FmkdIbA38fGVtWx+MDHFshmQk=' 
WHERE 
  key_id = '7c7ae01ffcd0c23b300571c8200bb205e2904786de5d8e974f42f5068303c396' 
  AND (
    token = 'BtuvzS9sJ0xsx6V9y/FmkdIbA38fGVtWx+MDHFshmQk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028