UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mHgtnQzcNXiNyGFYSnIPhPmSTRlPNotUeAdR/gVqXYg=' 
WHERE 
  key_id = '31e7ba86d7fa9ffc473d07c3233c33bd5ec6b177742a1d8ee9cf2e04a15abf96' 
  AND (
    token = 'mHgtnQzcNXiNyGFYSnIPhPmSTRlPNotUeAdR/gVqXYg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027