UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tmi+oFhf+fPI6Ih7Kjvwj5jy9wtvYMV3RKvsyGDvL/c=' 
WHERE 
  key_id = '1d98681e03455d51bc0f2f7b0711fca256466e096fac736b1a3723b44acbfdc4' 
  AND (
    token = 'Tmi+oFhf+fPI6Ih7Kjvwj5jy9wtvYMV3RKvsyGDvL/c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029