UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OBXJFxh4ls/5sSiaPdM7I4QCSJGIFWiOwI4z2sTPpTk=' 
WHERE 
  key_id = '45e983cf53e9fc85c15eff9323f63e47695174624cfedfbf67489e188db175c5' 
  AND (
    token = 'OBXJFxh4ls/5sSiaPdM7I4QCSJGIFWiOwI4z2sTPpTk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041