UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nKPkzAlDdCZpJwtdymvHtrtyVnsSVnAAlkPL52fGMtA=' 
WHERE 
  key_id = '4bddb0653f345ba58b8690370ffc74cf356a03dd698abcbb405022802775fa63' 
  AND (
    token = 'nKPkzAlDdCZpJwtdymvHtrtyVnsSVnAAlkPL52fGMtA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044