UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8clHWdbCPQnbIDBsplG3y0sfdzNSFjVyM30XspNwKxQ=' 
WHERE 
  key_id = '84402fee659c1bc0189316328df7914eda0e170c61f5e07b8ed6597dc48c35b5' 
  AND (
    token = '8clHWdbCPQnbIDBsplG3y0sfdzNSFjVyM30XspNwKxQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032