UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W6LGq0eJ9uKA9BcclDRoQNMjyhjUtWbo84rUJKyD9b0=' 
WHERE 
  key_id = '74631099d6136cbd53b6b5f667136340af5723cd1842e06ac7f2d09fa6bca059' 
  AND (
    token = 'W6LGq0eJ9uKA9BcclDRoQNMjyhjUtWbo84rUJKyD9b0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051